home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Experimental BBS Explossion 3
/
Experimental BBS Explossion III.iso
/
msdos
/
choose21.zip
/
MM_BRA.SDX
< prev
next >
Wrap
Text File
|
1993-12-15
|
1KB
|
24 lines
FLOW CONTROL (BATCH BRANCHING) under CHOOSE
The power of CHOOSE results from the ability to change the course of
execution within batch streams via menu selections. DOS's "ERRORLEVEL"
is used to effect branching within a batch file.
Whenever a menu selection is made, CHOOSE sets the ERRORLEVEL as follows
and exits to DOS.
ERRORLEVEL=3 THIRD to LAST menu selection made
ERRORLEVEL=2 SECOND to LAST menu selection made
ERRORLEVEL=1 LAST menu selection made
ERRORLEVEL=0 ESCAPE struck
BATCH's "IF ERRORLEVEL=" sub-commands are used following each CHOOSE
line to cause the appropriate branching in control flow as shown below.
CHOOSE *** MAIN MENU ***^Windows^WordPerfect^Backup
IF ERRORLEVEL=3 GOTO :WINDOWS
IF ERRORLEVEL=2 GOTO :WORD_PROC
IF ERRORLEVEL=1 GOTO :TAPE_BACKUP
GOTO :ESC_STRUCK